package com.xiaoh.dormitoryrepairreportbackend.common;

/**
 * 错误码枚举
 */
public enum ErrorCode {

    SUCCESS(0, "操作成功"),
    PARAMS_ERROR(40000, "请求参数错误"),
    NOT_LOGIN_ERROR(40100, "未登录"),
    NO_AUTH_ERROR(40101, "无权限"),
    NOT_FOUND_ERROR(40400, "请求数据不存在"),
    FORBIDDEN_ERROR(40300, "禁止访问"),
    SYSTEM_ERROR(50000, "系统内部异常"),
    OPERATION_ERROR(50001, "操作失败"),

    // 用户相关错误
    USER_NOT_EXIST(40401, "用户不存在"),
    USER_ALREADY_EXIST(40402, "用户已存在"),
    PASSWORD_ERROR(40403, "密码错误"),
    ACCOUNT_DISABLED(40404, "账号已禁用"),

    // 工单相关错误
    WORK_ORDER_NOT_EXIST(40501, "工单不存在"),
    WORK_ORDER_STATUS_ERROR(40502, "工单状态错误"),
    WORK_ORDER_PERMISSION_ERROR(40503, "无权限操作此工单"),

    // 物料相关错误
    MATERIAL_NOT_EXIST(40601, "物料不存在"),
    MATERIAL_STOCK_INSUFFICIENT(40602, "物料库存不足"),

    // 类别相关错误
    CATEGORY_NOT_EXIST(40701, "维修类别不存在"),
    CATEGORY_DISABLED(40702, "维修类别已禁用");

    /**
     * 状态码
     */
    private final int code;

    /**
     * 信息
     */
    private final String message;

    ErrorCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
